
package com.market.web.action;

import java.util.List;

import com.market.bean.Product;
import com.market.web.XMLLoader;
import com.market.web.form.ProductForm;
import com.market.web.utils.ListUtils;

public class HomeAction extends BaseAction2
{

    int oldCount;

    int curCount;

    public String execute() throws Exception
    {
        curCount++;
        if (curCount == 0 || oldCount == 0)
        {
            oldCount = curCount = XMLLoader.getCount();
        }
        if ((curCount - oldCount) == 10)
        {
            //boolean b = XMLLoader.setCount(curCount);
            oldCount = XMLLoader.getCount();
        }
        List hotList = getProductService().getHotList(null, 3);
        List hotBarList = getProductService().getHotList(null, 10);
        getRequest().setAttribute("hotProduct", ListUtils.convert(hotList, Product.class, ProductForm.class));
        getRequest().setAttribute("hotProBar", ListUtils.convert(hotBarList, Product.class, ProductForm.class));
        getRequest().setAttribute("count", String.valueOf(curCount));
        return SUCCESS;
        //return mapping.findForward("home");
    }

}
